#pragma once

#include "../TcpServer.h"
#include <google/protobuf/service.h>
#include <google/protobuf/descriptor.h>

class RpcServer
{
public:
    RpcServer(EventLoop* loop, int port);

    void setThreadNum(int numThreads) { server_.setThreadNum(numThreads); }

    void registerService(::google::protobuf::Service*);
    void start();

private:
    void onConnection(const TcpConnectionPtr& conn);

    TcpServer server_;
    std::map<std::string, ::google::protobuf::Service*> services_;
};